home *** CD-ROM | disk | FTP | other *** search
/ Shareware Extravaganza 7 / Shareware Extravaganza 8 (Most Significant Bits) (Disc 7).iso / win95b / wb32-96a.zip / PROGMAN.WI_ < prev    next >
Text File  |  1995-12-28  |  7KB  |  210 lines

  1. ;;Program manager WBT script.  Adding/Deleting/Showing Program Manager Groups and Icons.  
  2.  
  3.                     ;;Written February 1994  by Wilson WindowWare, Inc.  
  4.                     ;;Modifed July 1995
  5.  
  6. ;;Call Progman.wil
  7. ;;Syntax of commands:
  8. ;;    Call("progman.wil", "AddGroup 'Group Title'")
  9. ;;        (             , "DelGroup 'Group Title'")
  10. ;;        (             , "AddIcon 'Group Title' 'File and Path' 'Icon Description''wrk dir'")
  11. ;;        (             , "DelIcon 'Group Title' 'Icon Description'")
  12. ;;        (             , "ShowGroup 'Group Title' ShowCommand")
  13. ;;        (             , "ReplaceItem 'Group Title' 'Icon Description'")
  14. ;;        (             , "Reload 'Group Title'")
  15. ;;        (             , "IconDump 'Group Title''Icon Description' 'variable name'")
  16. ;;        (             , "ProgBuild 'Group Title''variable name'")
  17. ;;        (             , "ListGroups")    ; Sets variable GROUP to tab delimited list of groups
  18. ;;    Call("progman.wil", "AddNewData '%grptitle%', '%data%'")
  19.  
  20.  
  21. ;;Show command is an integer which specifies the action Program Manager is to perform on the group window.
  22. ;;        VALUE          ACTION
  23. ;;          1               Restores group to its original size and position.
  24. ;;          2               Displays group as an icon.
  25. ;;          3               Displays group as a maximized window.
  26. ;;          6               Minimizes the group window.
  27. ;;                                 
  28.  
  29.  
  30. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  31. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  32. ;Check to see if Program manager is running.  If not, run it.
  33. AX=DDEInitiate("Progman", "Progman")
  34. IF AX==0    ; Hmmm nobody's home
  35.     run("progman.exe","")
  36.     delay(2)
  37.     AX=DDEInitiate("Progman", "Progman")
  38.     If AX==0     ;   ooooo its really dead.  Give up
  39.          Message("Program Manager DDE Initiate", "Didn't work.  Giving up.  Going home")
  40.          return 
  41.     endif
  42. endif
  43.  
  44.  
  45. ErrorMode(@OFF)
  46. If AppExist("Progman.exe")  then WinActivate("Program Manager")
  47. ErrorMode(@ON)
  48. ErrorMSG=""
  49. ; Fake a case statement with a string for a variable
  50. Goto %Param1%
  51.            
  52.  
  53.  
  54. :ADDGROUP
  55. ;Add a group to program manager.                                                              
  56.      
  57. Err=DDEExecute(AX,"[CreateGroup(%param2%)]")
  58. If Err==0 then ErrorMSG="[CreateGroup(%param2%)] Failed"
  59. goto byebye
  60.  
  61.  
  62.  
  63. :ListGroups
  64. ;List groups.                                                              
  65. Groups=DDERequest(AX,"Groups")
  66. If Groups==0 then ErrorMSG="Groups Failed"
  67. Groups=strreplace(groups,@crlf,@tab)
  68. goto byebye
  69.  
  70.  
  71.  
  72. :DELGROUP
  73. ;Delete a group from the program manager.
  74.      
  75. Err=DDEExecute(AX,"[DeleteGroup(%param2%)]")
  76. If Err==0 then ErrorMSG="[DeleteGroup(%param2%)] Failed"
  77. goto byebye
  78.  
  79.  
  80.  
  81. :ADDICON
  82. ;Add an icon to a program group.
  83.  
  84. ;show or create the group first.
  85. DDEExecute(AX,"[CreateGroup(%param2%)]")
  86. ;Add the item.     
  87. Err=DDEExecute(AX,"[AddItem(%param3%,%param4%,,,-1,-1,%param5%,0)]")
  88. If Err==0 then ErrorMSG="[AddItem(%param3%,%param4%,,,-1,-1,%param5%,0)] Failed"
  89. goto byebye
  90.  
  91.  
  92.  
  93.  
  94.  
  95. :DELICON
  96. ;Delete an icon from the program manager.
  97.  
  98. ;show or create the group
  99. DDEExecute(AX,"[ShowGroup(%param2%,1)]")
  100. ;Delete the icon.     
  101. Err=DDEExecute(AX,"[DeleteItem(%param3%)]")
  102. If Err==0 then ErrorMSG="[DeleteItem(%param3%)] Failed"
  103. goto byebye
  104.  
  105.  
  106.  
  107.  
  108. :SHOWGROUP
  109. ;Show a program group. 
  110.      
  111. ;show or create the group
  112. Err=DDEExecute(AX,"[ShowGroup(%param2%,%param3%,)]")
  113. If Err==0 then ErrorMSG="[ShowGroup(%param2%,%param3%,)] Failed"
  114. goto byebye
  115.  
  116.  
  117.  
  118.  
  119. :RELOAD
  120. ;This command instructs Program Manager to remove and reload an existing group.
  121.  
  122. ;Show the group.
  123. DDEExecute(AX,"[ShowGroup(%param2%,1)]")
  124. delay(2)
  125. Err=DDEExecute(AX,"[Reload(%param2%)")
  126. If Err==0 then ErrorMSG="[Reload("")] Failed"
  127. goto byebye
  128.  
  129.  
  130.  
  131.  
  132. :REPLACEITEM
  133. ;This command deletes an item and records the position.  A new item can be added to this 
  134. ;position using AddIcon.
  135.  
  136. ;Show the group.
  137. DDEExecute(AX,"[ShowGroup(%param2%,1)]")
  138. delay(2)
  139.  
  140. ;record the position and delete existing group.
  141. Err=DDEExecute(AX,"[ReplaceItem(%param3%)]")
  142. If Err==0 then ErrorMSG="[ReplaceItem(%param3%)] Failed"
  143. goto byebye
  144.  
  145. :ADDNEWDATA
  146. ;Add an icon by adding all information. Use with Progbuild or IconDump to create line.
  147.  
  148. ;show or create the group first.
  149. DDEExecute(AX,"[CreateGroup(%param2%)]")
  150. ;Add the item.     
  151. Err=DDEExecute(AX,"[AddItem(%param3%)]")
  152. If Err==0 then ErrorMSG="[AddItem(%param3%)] Failed"
  153. goto byebye
  154.  
  155.  
  156. :IconDump 
  157. ;;This command accesses a group and then searches the group for a specific icon title.
  158. ;;The DDE Syntax for the icon is returned to the calling program as a variable.
  159. ;;Open a channel to a specified Group
  160.  
  161. groups= DDERequest(AX, param2)
  162. groups = StrReplace(groups, @crlf, @tab)
  163. groups = ItemSort(groups, @tab)
  164. count=ItemCount(groups,@tab)
  165. For j = 1 to count by 1
  166.         item = ItemExtract(j, groups, @tab)
  167.         itemicon=ItemExtract(1, item, ",")
  168.         if '"%param3%"'==itemicon then break   ;; Compare each line to the specified icon title.
  169. Next            
  170. if '"%param3%"'!=itemicon      ;;If the specified icon title is found, break loop.
  171.         ErrorMSG="[IconDump] Failed"
  172.         break
  173. else
  174.         %param4%=item   ;;icon title is set to equal and then returned as the supplied variable name.
  175.         grptitle="%param2%"
  176. endif
  177. goto byebye
  178.  
  179.  
  180. :PROGBUILD
  181. ;;This command accesses a group and then searches the group for a specific icon title.
  182. ;;The DDE Syntax for the icon is returned to the calling program as a variable.
  183. while @true
  184.         groups= DDERequest(AX, "Groups")                ;;Create a list of all Groups.
  185.         groups = StrReplace(groups, @crlf, @tab)
  186.         groups = ItemSort(groups, @tab)
  187.         group=AskItemList("Groups", groups, @tab, @unsorted, @single)   ;;Display a list box
  188.            grptitle="%group%"
  189.            items = DDERequest(AX, group)                 ;;Create a list of icons within chosen group.
  190.            items = StrReplace(items, @crlf, @tab)
  191.            items = ItemRemove(1, items, @tab)
  192.            items = ItemSort(items, @tab)
  193.            item=AskItemList("Groups", items, @tab, @unsorted, @single)       ;;Display a list box
  194.         %param2%=item     ;;icon title is set to equal and then returned as the supplied variable name.
  195.         break
  196. endwhile
  197.  
  198. If groups == "***NACK***" Then ErrorMSG="[ProgBuild(groups)] Failed "    
  199. If items == "***NACK***" Then ErrorMSG="[ProgBuild(items)] Failed"
  200. If item == "" Then ErrorMSG="[ProgBuild (item)] Failed"
  201. goto byebye
  202.  
  203. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  204. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  205. :byebye
  206. DDETerminate(AX)
  207. If ErrorMSG!="" then message("Progman DDE Failed", ErrorMSG)
  208. RETURN
  209.  
  210.